<?php
  class MY_Loader extends CI_Loader
    {
        /**
        * Load View
        *
        * This function is used to load a "view" file.  It has three parameters:
        *
        * 1. The name of the "view" file to be included.
        * 2. An associative array of data to be extracted for use in the view.
        * 3. TRUE/FALSE - whether to return the data or load it.  In
        * some cases it's advantageous to be able to return data so that
        * a developer can process it in some way.
        *
        * @param    string
        * @param    array
        * @param    bool
        * @return    void
        * @return    void
        * @param    string
        */
        public function view($view, $vars = array(), $return = FALSE,$runMasterPage = FALSE,$path = null)
        {
            #masterPage Header
            if($runMasterPage)
            {
                parent::view($path.'header',$vars,$return);
            }

            #view
            $return = parent::view($path.$view,$vars,$return);

            #masterPage footer
            if($runMasterPage)
            {
                parent::view($path.'footer',$vars,$return);
            }

            return $return;
        }
    }
?>
